#include<iostream>
#include<memory>

class MyClass {
public:
    MyClass(int x, int y) : x_(x), y_(y) {
        std::cout << "MyClass constructor called."<< std::endl;
    }
    ~MyClass() {
        std::cout << "MyClass destructor called."<< std::endl;
    }
    void print() const {
        std::cout << "x: " << x_ << ", y: " << y_ << std::endl;
    }
private:
    int x_;
    int y_;
};

void test_make_shared()
{
    std::shared_ptr<MyClass> ptr = std::make_shared<MyClass>(10, 20);
    ptr->print();
}

int main()
{
    test_make_shared();
    return 0;
}

/* valgrind
MyClass constructor called.
x: 10, y: 20
MyClass destructor called.

All heap blocks were freed -- no leaks are possible
 */